import request from '@/utils/request'

// 查看所有学期
export function getAllSemester() {
  return request({
    url: 'Semester/selectAllAct',
    method: 'GET'
  })
}
// 查看当前学期
export function findNowSemester() {
  return request({
    url: 'Semester/findNowSemester',
    method: 'GET'
  })
}
// 当前是否有开放的学期
export function findOpenSemester() {
  return request({
    url: 'Semester/findIsNowSemester',
    method: 'GET'
  })
}
// 修改学期
export function updateSemester(semester) {
  return request({
    url: 'Semester/updateByPrimaryKey',
    method: 'PUT',
    params: {
      semCheckStartTime: semester.semCheckStartTime,
      semCheckStopTime: semester.semCheckStopTime,
      semId: semester.semId,
      semName: semester.semName,
      semSendStartTime: semester.semSendStartTime,
      semSendStopTime: semester.semSendStopTime,
      semStatus: semester.semStatus
    }
  })
}
// 删除学期
export function delSemester(semId) {
  return request({
    url: 'Semester/deleteByPrimaryKey',
    method: 'DELETE',
    params: {
      semId: semId
    }
  })
}
// 添加学期
export function addSemester(semester) {
  return request({
    url: 'Semester/inster',
    method: 'POST',
    params: {
      semCheckStartTime: semester.semCheckStartTime,
      semCheckStopTime: semester.semCheckStopTime,
      semId: semester.semId,
      semName: semester.semName,
      semSendStartTime: semester.semSendStartTime,
      semSendStopTime: semester.semSendStopTime,
      semStatus: semester.semStatus
    }
  })
}
// 根据主键查看当前学期信息
export function getSemester(semId) {
  return request({
    url: 'Semester/selectByPrimaryKey',
    method: 'GET',
    params: {
      semId: semId
    }
  })
}
// 通过学期ID查看学期
export function findNowSemesterByID(id) {
  return request({
    url: 'Semester/selectByPrimaryKey',
    method: 'GET',
    params: {
      semId: id
    }
  })
}
